package com.wetalk.utils;
import jakarta.mail.internet.InternetAddress;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

/**
 * @author lijiaxing 2025-7-5
 */
@Service
public class  MailService {

    @Autowired
    private  JavaMailSender mailSender;

    // 注入配置的发件人邮箱
    private static String from="2738233303@qq.com";

    public void sendSimpleMail(String to, String subject, String content) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom(from);   // 发件人
        message.setTo(to);       // 收件人
        message.setSubject(subject);   // 标题
        message.setText(content);     // 内容

        mailSender.send(message);
    }
}
